<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="layout">

<div layout:fragment="body">
    <!--<div id="toptoolbar"></div>-->
    <div id="searchformDiv">
        <form id='searchform' class="l-search-form">
            <div class="layui-inline">
                <input type="text" class="l-text" name="search_LIKE_houseAddress" th:placeholder="#{estateEvalInfo.houseAddress}"/>
            </div>
            <div class="layui-inline">
                <input type="text" th:placeholder="#{estateEvalInfo.propertyType}" liger="{type:'comboBox', valueFieldID:'search_EQ_propertyType',configCode:'PROPERTY_TYPE'}"/>
                <input id="search_EQ_propertyType" name="search_EQ_propertyType" style="display: none;">
            </div>
            <div class="layui-inline">
                <input type="reset" class="l-reset" th:value="#{reset}" />
                <input type="button" class="l-search" th:value="#{search}" onclick="f_search();" />
            </div>
        </form>
    </div>
    <div id="maingrid"></div>
</div>

<!-- page specific plugin scripts -->
<script type="text/javascript" layout:fragment="script">/*<![CDATA[*/
var maingrid;
$(function() {
    maingrid = newGrid("maingrid", {
        columns : [
            {
                display : '[[#{estateEvalInfo.houseAddress}]]',
                name : 'houseAddress',
                align : 'left',
                width : 200
            },{
                display : '[[#{estateEvalInfo.buildingCode}]]',
                name : 'buildingCode',
                align : 'center',
                width : 160
            },{
                display : '[[#{estateEvalInfo.propertyType}]]',
                name : 'config_propertyType',
                align : 'center',
                width : 80
            },{
                display : '[[#{estateEvalInfo.cellNo}]]',
                name : 'cellNo',
                align : 'left',
                width : 80
            },{
                display : '[[#{estateEvalInfo.roomNo}]]',
                name : 'roomNo',
                align : 'left',
                width : 80
            },{
                display : '[[#{estateEvalInfo.begin}]]',
                name : 'begin',
                align : 'right',
                width : 80
            },{
                display : '[[#{estateEvalInfo.end}]]',
                name : 'end',
                align : 'right',
                width : 80
            },{
                display : '[[#{estateEvalInfo.roomSize}]]',
                name : 'roomSize',
                align : 'right',
                width : 80
            },{
                display : '[[#{estateEvalInfo.houseTotalPrice}]]',
                name : 'houseTotalPrice',
                align : 'right',
                type : 'currency',
                width : 120
            },{
                display : '[[#{estateEvalInfo.houseUnitPrice}]]',
                name : 'houseUnitPrice',
                align : 'right',
                type : 'currency',
                width : 120
            },{
                display : '[[#{estateEvalInfo.landUseRights}]]',
                name : 'landUseRights',
                align : 'center',
                width : 80
            },{
                display : '[[#{estateEvalInfo.buildStruct}]]',
                name : 'buildStruct',
                align : 'center',
                width : 80
            },{
                display : '[[#{estateEvalInfo.buildYear}]]',
                name : 'buildYear',
                align : 'center',
                width : 80
            },{
                   display : '[[#{createdAt}]]',
                name : 'createdAt',
                type : 'datetime',
                width : 120
            },{
                   display : '[[#{updatedAt}]]',
                name : 'updatedAt',
                type : 'datetime',
                width : 120
            }],
        url : '/estateEvalInfo/list'
    });

    $("#toptoolbar").ligerToolBar({
        items : [/* {
            text : '增加',
            click : addClick,
            icon : 'add'
        }, {
            text : '修改',
            click : modifyClick,
            icon : 'modify'
        }, {
            text : '删除',
            click : deleteClick,
            icon : 'delete'
        }, {
            text : '查看',
            click : viewClick,
            icon : 'view'
        } */]
    });

    maingrid.setHeight(document.documentElement.clientHeight - $("#toptoolbar").height() -  $("#searchform").height() - 18);
});

function addClick(item) {
    openForm({url : '/estateEvalInfo/form',title : '新增'})
}

function modifyClick(item) {
    isSingleSelected(maingrid, function(row) {
        openForm({
            url : '/estateEvalInfo/form?id=' + row['id'],
            title : '编辑'
        });
    });
}

function deleteClick(item) {
    isSingleSelected(maingrid, function(row) {
        showConfirm('确定要删除', function(yes) {
            if (yes) {
                ajaxDo('/estateEvalInfo/delete?id=' + row['id']);
            }
        });
    });
}

function viewClick(item) {
    isSingleSelected(maingrid, function(row) {
        openDialog({
            title: '查看',
            url : '/estateEvalInfo/view?id=' + row['id']});
    });
}

function f_search() {
    loadGridData(maingrid, "searchform");
}

function f_reload() {
    maingrid.loadData(true);
}
/*]]>*/</script>
</html>
